#include <iostream>
#include <string>

using namespace std;

int main()
{   string s;
    cout<<"vvedite posledovatelnost"<<endl;
    cin>>s;
    string s1;
    char a;
    for(int i=0;i<s.length();i++)
    {a=s[i];
        if ((a=='(')||(a=='{')||(a=='[')||(a=='<') || s1=="")
                s1+=a;
    else
    {
        if(s1!="")
    {
        if(((a==')') && (s1[s1.length()-1]=='(')) ||((a=='}') && (s1[s1.length()-1]=='{')) ||((a==']') && (s1[s1.length()-1]=='[')) ||((a=='>') && (s1[s1.length()-1]=='<')) )
            s1.pop_back();
    }
   }
   }
if (s1=="")
        cout<<"True";
else cout<<"False";


    return 0;}
